-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(context-menu): make divider on context menu aware of available options #2766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryThis PR makes two unrelated but clean improvements to the codebase: Context Menu Divider Logic (Primary Change)What changed: The context menu now intelligently shows/hides dividers based on whether menu sections actually have visible items, not just whether the section flags are enabled. Why this matters: The old implementation had a bug where dividers would appear even when no menu items existed in a section. For example:
Implementation: Three boolean flags track section visibility:
These flags are used to conditionally render dividers, preventing empty sections from creating visual clutter with unnecessary dividers. Edge cases handled correctly:
Avatar Component Cleanup (Secondary Change)What changed: Removed the unused Impact: Safe removal - no usages found in codebase outside the playground examples. The component still supports Changes:
Both changes improve code quality: the context menu fix prevents UI bugs with orphaned dividers, and the Avatar cleanup removes dead code. Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant ContextMenu
participant MenuItem
participant Divider
User->>ContextMenu: Right-click item
ContextMenu->>ContextMenu: Calculate section visibility
Note over ContextMenu: hasNavigationSection = showOpenInNewTab && onOpenInNewTab
Note over ContextMenu: hasEditSection = (showRename && onRename) || (showCreate && onCreate) || (showCreateFolder && onCreateFolder)
Note over ContextMenu: hasCopySection = (showDuplicate && onDuplicate) || (showExport && onExport)
alt hasNavigationSection
ContextMenu->>MenuItem: Render "Open in new tab"
alt hasEditSection OR hasCopySection
ContextMenu->>Divider: Render divider
end
end
alt hasEditSection
ContextMenu->>MenuItem: Render Edit items (Rename/Create/CreateFolder)
alt hasCopySection
ContextMenu->>Divider: Render divider
end
end
alt hasCopySection
ContextMenu->>MenuItem: Render Copy items (Duplicate/Export)
end
alt hasNavigationSection OR hasEditSection OR hasCopySection
ContextMenu->>Divider: Render divider before Delete
end
ContextMenu->>MenuItem: Render "Delete" (always visible)
ContextMenu->>User: Display context menu
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 1 comment
Summary
Type of Change
Testing
Tested manually
Checklist